package org.zhengquan.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.zhengquan.common.JsonData;
import org.zhengquan.service.SysLogService;
import org.zhengquan.vo.PageQuery;
import org.zhengquan.vo.SearchLogVo;

/**
 * @author zhengquan
 * @date 2017/11/6
 */
@Controller
@RequestMapping("/sys/log/")
public class SysLogController {
    @Autowired
    private SysLogService sysLogService;


    @RequestMapping("log.page")
    public ModelAndView page() {
        return new ModelAndView("log");
    }

    @RequestMapping("search.json")
    @ResponseBody
    public JsonData search(SearchLogVo searchLogVo, PageQuery pageQuery) {
        return JsonData.success(sysLogService.searchPageList(searchLogVo, pageQuery));
    }

    @RequestMapping("recover.json")
    @ResponseBody
    public JsonData recover(@RequestParam int id) {
        sysLogService.recover(id);
        return JsonData.success();
    }


}
